import React, { PropTypes } from 'react';

const propTypes = {
  id: PropTypes.number,
  text: PropTypes.string,
};

const defaultProps = {
  text: 'Hello World',
};

class UserInfo extends React.Component {
  constructor(props) {
    super(props);
    this.state = {
      userinfo:{
        id:'',
        loginname:'',
      },
      isLogin:false,
    }
    // return false;
  }
  static methodsAreOk() {
    return true;
  }
  componentWillMount() {
    console.log('componentWillMount');
    return false;
  }
  componentDidMount() {
    console.log('componentDidMount');
    return false;
  }
  componentWillReceiveProps() {
    console.log('componentWillReceiveProps---userinfo');
    return false;
  }
  shouldComponentUpdate() {
    return true;
  }
  componentWillUpdate() {
    console.log('componentWillUpdate');
    return false;
  }
  componentDidUpdate() {
    console.log('componentDidUpdate');
    // return false;
  }
  componentWillUnmount() {
    console.log('componentWillUnmount');
    // return false;
  }
  clickHandlers() {
    console.log('clicked');
    // return false;
  }
  render() {
    if (!this.state.isLogin) {
      return (<div className="user-info">
          <ul className="login-no">
              <li className="login"><a>登录</a></li>
          </ul>
        </div>)
      } else {
        return (
    	    <div className="user-info">
    	        <div className="login-yes">
    	            <div className="avertar">
                    <img v-if="avatar_url" src="avatar_url"/>
                  </div>
    	            <div className="info">
    	                <p v-text="loginname"></p>
    	            </div>
    	        </div>
    	    </div>
      );
    }
  }
}

UserInfo.propTypes = propTypes;
UserInfo.defaultProps = defaultProps;

export default UserInfo;